package com.cn.lf.wx.compent;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.context.ApplicationContext;
import org.springframework.web.servlet.HandlerInterceptor;
import org.springframework.web.servlet.ModelAndView;

import com.cn.lf.wx.dacs.bussiness.author.common.ApplicationContextUtil;





public class AppHandlerInterceptor implements HandlerInterceptor {

	@Override
	public void afterCompletion(HttpServletRequest arg0,
			HttpServletResponse arg1, Object arg2, Exception arg3)
			throws Exception {

	}

	@Override
	public void postHandle(HttpServletRequest arg0, HttpServletResponse arg1,
			Object arg2, ModelAndView arg3) throws Exception {

	}

	@Override
	public boolean preHandle(HttpServletRequest request, HttpServletResponse response,
			Object arg2) throws Exception {
		String path = request.getServletPath();

		return true;
	}
	
	private boolean dealWithReq(HttpServletRequest request,
			HttpServletResponse response,String openId,String path) throws IOException, ServletException {
		if("/app/login".equals(path)) {
			return true; 
		} else {
			return this.checkRegiested(request, response, openId);
		}
	}
	
	private boolean checkRegiested(HttpServletRequest request,
			HttpServletResponse response,String openId) throws IOException, ServletException {
		ApplicationContext appContext = ApplicationContextUtil.getApplicationContext();

			return true;
		
	}

}
